Skip to content

fix(cli): avoid node util styleText dependency in setup wizard#12

Closed
freelanceagent1 wants to merge 2 commits intocortexkit:mainfrom
freelanceagent1:fix/cli-node19-prompts
Closed

fix(cli): avoid node util styleText dependency in setup wizard#12
freelanceagent1 wants to merge 2 commits intocortexkit:mainfrom
freelanceagent1:fix/cli-node19-prompts

Conversation

@freelanceagent1
Copy link
Copy Markdown
Contributor

Summary

Fixes the aft-opencode setup / doctor CLI crash on older Node runtimes where node:util.styleText is unavailable.

The failure reported was:

$ bunx @cortexkit/aft-opencode@latest setup
SyntaxError: The requested module 'node:util' does not provide an export named 'styleText'

Cause

The CLI prompt path depended on @clack/prompts, which pulled in a runtime path that expected newer Node node:util exports than are available on Node 19.9.0.

Fix

  • replace the CLI prompt wrapper with a small Node-native implementation
  • remove @clack/prompts from the plugin package dependencies
  • keep the existing setup / doctor CLI behavior intact

Validation

  • bun install
  • bun run build in packages/opencode-plugin
  • node packages/opencode-plugin/dist/cli.js

Additionally, the built dist/cli.js no longer contains:

  • styleText
  • stripVTControlCharacters
  • @clack/prompts
  • node:util

Compatibility note

  • validated on the current Windows host by rebuilding and running the bundled CLI
  • this change is intended to improve compatibility for older Node runtimes, including the reported macOS arm64 Node 19.9.0 case
  • I did not runtime-test on macOS in this branch from this machine

@freelanceagent1 freelanceagent1 force-pushed the fix/cli-node19-prompts branch from 7215f95 to 07cefc0 Compare April 16, 2026 16:11
@ualtinok
Copy link
Copy Markdown
Collaborator

Thanks for the PR and the careful diagnosis — you correctly identified the root cause.

We ended up fixing this a different way in v0.13.1: instead of removing `@clack/prompts`, we changed all documented commands to use `bunx --bun` instead of `bunx`. The `--bun` flag tells bun to execute the JavaScript directly with its own runtime, bypassing the `#!/usr/bin/env node` shebang that was routing to the user's older Node. This preserves the `@clack/prompts` UX (colors, prompts, spinners) while working on any Node version — or with no Node installed at all.

Closing this PR since the underlying issue (#10) is resolved, but genuinely appreciate the contribution and investigation. 🙏

@ualtinok ualtinok closed this Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants